package nancal.mp.feign;


import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

;

@FeignClient(name = "nacosConfig", url = "${spring.cloud.nacos.config.server-addr}")
public interface NacosConfigClient {


    @GetMapping(value = "nacos/v1/cs/configs", consumes = {"application/x-www-form-urlencoded; charset=utf-8"})
    String getConfig(@RequestParam String dataId, @RequestParam String namespaceId, @RequestParam String tenant, @RequestParam String accessToken,
                     @RequestParam String group, @RequestParam String show);

    @PostMapping(value = "nacos/v1/cs/configs", consumes = {"application/x-www-form-urlencoded; charset=utf-8"})
    Boolean createGroupText(@RequestParam String dataId, @RequestParam String group, @RequestParam String content,
                            @RequestParam(value = "config_tags") String configTags, @RequestParam String desc,
                            @RequestParam String type, @RequestParam String appName, @RequestParam String tenant,
                            @RequestParam String namespaceId, @RequestParam String accessToken);


    @GetMapping(value = "nacos/v1/cs/configs", consumes = {"application/x-www-form-urlencoded; charset=utf-8"})
    String getConfigList(@RequestParam Integer pageNo, @RequestParam Integer pageSize, @RequestParam String tenant,
                         @RequestParam String search, @RequestParam String dataId, @RequestParam String group);

    @GetMapping(value = "nacos/v1/cs/configs", consumes = {"application/x-www-form-urlencoded; charset=utf-8"})
    String getConfigDetail(@RequestParam String show, @RequestParam String tenant, @RequestParam String dataId, @RequestParam String group);

    @PostMapping(value = "nacos/v1/cs/configs", consumes = {"application/x-www-form-urlencoded; charset=utf-8"})
    Boolean createConfig(@RequestParam String id, @RequestParam String tenant, @RequestParam String dataId, @RequestParam String group,
                         @RequestParam String content, @RequestParam String type, @RequestParam String desc);

    @DeleteMapping(value = "nacos/v1/cs/configs", consumes = {"application/x-www-form-urlencoded; charset=utf-8"})
    Boolean deleteConfig(@RequestParam String tenant, @RequestParam String dataId, @RequestParam String group);

}
